package com.tencent.sr.iris.activity.service.activity;

import com.tencent.sr.iris.activity.interfaces.dto.ActivityInfoDTO;
import com.tencent.sr.iris.activity.interfaces.request.acticity.GetJuniorTaskRecordListRequest;
import com.tencent.sr.iris.activity.repository.entity.TIrisUserActivityRecordDO;
import com.tencent.sr.iris.activity.repository.entity.TIrisUserTaskRecordDO;
import com.tencent.sr.rmall.common.request.PaginationRequest;
import com.tencent.sr.rmall.common.response.PaginationResponse;

import java.util.Date;
import java.util.List;

public interface IrisUserActivityRecordService {

    /**
     * 新增活更新活动记录
     * @param activityId
     * @param actPeriod
     * @param eventTime
     * @param periodType
     * @param uid
     */
    void addOrUpdateActivityRecord(String uid, Long eventTime, String activityId,
                                   int periodType, String actPeriod);

    /**
     * 新增或更新活动记录
     * @param uid
     * @param activityId
     * @param period
     * @param taskRecords
     */
    void doAddOrUpdateActivityRecord(String uid, String activityId, String period, List<TIrisUserTaskRecordDO> taskRecords);

    /**
     * 创建活动记录
     * @param taskRecords
     * @param newActivityRecord
     * @return
     */
    ActivityInfoDTO newActivityInfo(List<TIrisUserTaskRecordDO> taskRecords, boolean newActivityRecord);

    /**
     * 查询活动参与记录
     *
     * @param uid
     * @param activityId
     * @param period
     * @param taskId
     * @return
     */
    TIrisUserActivityRecordDO queryActivityRecord(String uid, String activityId, String period, String taskId);

    /**
     * 处理进行中的活动
     * @param uid
     * @param activityId
     * @return
     */
    int handleInProgressActivityRecord(String uid, String activityId);

    /**
     * 从es查询活动记录
     * @param request request
     * @return TIrisUserActivityRecordDO
     */
    PaginationResponse<TIrisUserActivityRecordDO> queryActivityRecordFromEs(PaginationRequest<GetJuniorTaskRecordListRequest> request);
    /**
     * 删除活动记录
     * @param uid
     * @param activityId
     * @param period
     * @return
     */
    int deleteActivityRecord(String uid, String activityId, String period);

    /**
     * 是否存在已完成的活动记录
     * @param uid
     * @param activityId
     * @param period
     * @return
     */
    boolean existActivityRecord(String uid, String activityId, String period);

    /**
     * 查询已发奖数
     * @param pid
     * @param date
     * @return
     */
    Integer queryAwardTotalByPid(String pid, Date date);
}
